<template>
	<view>
		<view class="content">
			首页
		</view>
		<view v-for="(item,index) in historyList" :key="index" class="content">
			{{item}}
		</view>
		<button @click="wxUserLogin">登录</button>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	import { apiUserLogin } from '@/api/user'
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		computed:{
			...mapState(['historyList'])
		},
		onLoad() {

		},
		methods: {
			wxUserLogin() {
				debugger
			  uni.login({
				provider: 'weixin',
				success: ({ code }) => {
				  if (code) {
					apiUserLogin(code).then((res) => {
					  console.log(res)
					})
				  }
				}
			  })
			},
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>
